package com.mazaiting.rabbitmq.domain.info;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * MQ 实体公共参数
 */
@Getter
public class MessageInfo<T> implements Serializable {

    /**
     * 交换机
     */
    private final String exchange;

    /**
     * 路由键
     */
    private final String routingKey;

    /**
     * 最大重试次数
     */
    @Setter
    private Integer maxRetryCount = 1;

    /**
     * 过期时间
     */
    @Setter
    private Integer expiration = 0;

    /**
     * 是否需要加锁
     */
    @Setter
    private Boolean exclusion = false;

    /**
     * 数据
     */
    @Setter
    private T data;

    public MessageInfo(String exchange, String routingKey) {
        this.exchange = exchange;
        this.routingKey = routingKey;
    }
}